﻿Imports JuegosLanBackend
Public Class EliminarJuego
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim id = Request.Params.Get("id")

        Dim negocio = New JuegoNegocio
        Dim modelo = negocio.obtener(id)

        Me.txtIdJuego.Value = modelo.idJuego
        Me.TxtNombre.Text = modelo.nombre
        Me.TxtVersion.Text = modelo.Version
        Me.TxtFabricante.Text = modelo.Fabricante
    End Sub

    Protected Sub BtnEliminar_Click(ByVal sender As Object, ByVal e As EventArgs) Handles BtnEliminar.Click
        Try
            Dim negocio = New JuegoNegocio
            negocio.eliminar(Me.txtIdJuego.Value)
            Response.Redirect("EditJuego.aspx", True)
        Catch ex As Exception
            Response.Write("No se pudo eliminar")
        End Try
    End Sub

    Protected Sub BtnVolver_Click(ByVal sender As Object, ByVal e As EventArgs) Handles BtnVolver.Click
        Response.Redirect("EditJuego.aspx", True)
    End Sub
End Class